package com.erlang.springmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @Description：默认类型的传递
 */
@Controller
@RequestMapping(value = "default-type")
public class DefaultTypeController {

    /**
     * @Description 默认类型的传递
     */
    @RequestMapping
    public ModelAndView defaultType(Model model, ModelMap modelMap, HttpSession session,
                                    HttpServletRequest request, HttpServletResponse response) throws IOException {
        ModelAndView modelAndView = new ModelAndView();
        model.addAttribute("model", "model类型");
        modelMap.addAttribute("modelMap", "modelMap类型");
        session.setAttribute("session", "session类型");
        request.setAttribute("request", "request类型");
        modelAndView.setViewName("default-type");
        return  modelAndView;
    }
}